home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 December / PCWorld_2000-12_cd.bin / Software / Vyzkuste / TextPad / TextPad Features_files / browser.js < prev    next >
Text File  |  2000-10-23  |  1KB  |  40 lines

  1.  
  2. function BrowserType()
  3. {
  4.     if ((navigator.appVersion.indexOf("Mac")!=-1)
  5.             && (navigator.userAgent.indexOf("MSIE")!=-1)
  6.             && (parseInt(navigator.appVersion)==3))
  7.         this.ie3Mac = true;
  8.     else {
  9.        // convert all characters to lowercase to simplify testing
  10.         var agt=navigator.userAgent.toLowerCase();
  11.  
  12.         // Note: On IE5, these return 4, so use is.ie5up to detect IE5.
  13.         this.major = parseInt(navigator.appVersion);
  14.         this.minor = parseFloat(navigator.appVersion);
  15.         this.opera = (agt.indexOf("opera") != -1);
  16.  
  17.         this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
  18.                     && (agt.indexOf('compatible') == -1) && (! this.opera)
  19.                     && (agt.indexOf('webtv')==-1));
  20.         this.nav2 = (this.nav && (this.major == 2));
  21.         this.nav3 = (this.nav && (this.major == 3));
  22.         this.nav4 = (this.nav && (this.major == 4));
  23.         this.nav4up = (this.nav && (this.major >= 4));
  24.         this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) ||
  25.                               (agt.indexOf("; nav") != -1)) );
  26.         this.nav5 = (this.nav && (this.major == 5));
  27.         this.nav5up = (this.nav && (this.major >= 5));
  28.  
  29.         this.ie   = (agt.indexOf("msie") != -1);
  30.         this.ie3  = (this.ie && (this.major < 4));
  31.         this.ie4  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")==-1) );
  32.         this.ie4up = (this.ie  && (this.major >= 4));
  33.         this.ie5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
  34.         this.ie5up  = (this.ie  && !this.ie3 && !this.ie4);
  35.     }
  36. }
  37.  
  38. var isBrowser;
  39. isBrowser = new BrowserType();
  40.